// pages/goods/goodsDetail/comps/shopInfo/shopInfo.js
const common = require('../../../../../utils/util.js')
const app = getApp()
var QQMapWX = require('../../../../../utils/qqmap-wx-jssdk.min.js')
var qqmapsdk
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        shopInfo: Object
    },

    /**
     * 组件的初始数据
     */
    data: {

    },

    /**
     * 组件的方法列表
     */
    methods: {
        goPhoneCall: function(e) {
            wx.makePhoneCall({
                phoneNumber: e.currentTarget.dataset.phone
            })
        },

        goNavigation: function(e) {
            qqmapsdk = new QQMapWX({
                key: 'NZMBZ-R4OEF-E7WJS-NRKOX-FWNFS-HHFLU'
            })
            const that = this
            qqmapsdk.geocoder({
                //获取表单传入地址
                address: e.currentTarget.dataset.address, //地址参数，例：固定地址，address: '北京市海淀区彩和坊路海淀西大街74号'
                success: function(res) { //成功后的回调
                    const latitude = res.result.location.lat
                    const longitude = res.result.location.lng
                    wx.openLocation({
                        latitude,
                        longitude,
                        name: e.currentTarget.dataset.address
                    })
                }
            })
        }
    }
})